using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace Ruminate.GUI.Framework {

    /// <summary>
    /// 
    /// </summary>
    internal class RootElement : Element {

        private ElementManager ElementManager { get; set; }

        public RootElement(LocationComponent locationComponent, InstanceData instanceData,
            ElementManager elementManager) : base(locationComponent) {

            ElementManager = elementManager;
            InstanceData = instanceData;
        }

        protected internal override void CharEntered(CharacterEventArgs e) {
            if (ElementManager.CharEntered != null) {
                ElementManager.CharEntered(null, e);
            }
        }

        protected internal override void KeyDown(KeyEventArgs e) {
            if (ElementManager.KeyDown != null) {
                ElementManager.KeyDown(null, e);
            }
        }

        protected internal override void KeyUp(KeyEventArgs e) {
            if (ElementManager.KeyUp != null) {
                ElementManager.KeyUp(null, e);
            }
        }

        protected internal override void MouseClick(MouseEventArgs e) {
            if (ElementManager.MouseClick != null) {
                ElementManager.MouseClick(null, e);
            }
        }

        protected internal override void MouseDoubleClick(MouseEventArgs e) {
            if (ElementManager.MouseDoubleClick != null) {
                ElementManager.MouseDoubleClick(null, e);
            }
        }

        protected internal override void MouseDown(MouseEventArgs e) {
            if (ElementManager.MouseDown != null) {
                ElementManager.MouseDown(null, e);
            }
        }

        protected internal override void MouseHover(MouseEventArgs e) {
            if (ElementManager.MouseHover != null) {
                ElementManager.MouseHover(null, e);
            }
        }

        protected internal override void MouseMove(MouseEventArgs e) {
            if (ElementManager.MouseMove != null) {
                ElementManager.MouseMove(null, e);
            }
        }

        protected internal override void MouseUp(MouseEventArgs e) {
            if (ElementManager.MouseUp != null) {
                ElementManager.MouseUp(null, e);
            }
        }

        protected internal override void MouseWheel(MouseEventArgs e) {
            if (ElementManager.MouseWheel != null) {
                ElementManager.MouseWheel(null, e);
            }
        }

        protected internal override void Init() {
            throw new NotImplementedException();
        }

        protected internal override void Render() {
            throw new NotImplementedException();
        }

        protected internal override void Update() {
            throw new NotImplementedException();
        }

        protected internal override void Draw() {
            throw new NotImplementedException();
        }

        protected internal override Rectangle ChildRenderArea() {
            return InstanceData.GraphicsDevice.Viewport.Bounds;
        }
    }
}
